package hua_rong_dao;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JButton;

public class Person extends JButton implements FocusListener {
    int number;
    Color c = new Color(255, 245, 170);//设置颜色
    Font font = new Font("宋体", Font.BOLD, 12);
    Person(int number, String s) {
        super(s);
        setBackground(c);//背景色
        setFont(font);
        this.number = number;
        c = getBackground();
        addFocusListener(this);//事件焦点监听器
    }

    public void focusGained(FocusEvent arg0) {//获得焦点触发器
        // TODO Auto-generated method stub
        setBackground(Color.red);//获得焦点颜色
    }

    public void focusLost(FocusEvent arg0) {//失去焦点触发器
        // TODO Auto-generated method stub
        setBackground(c);
    }

}
